<template>
  <div class="content-card">
    <div class="title">
      <a-icon type="tags"></a-icon>
      <span>{{ "资源类型占比" }}</span>
    </div>
    <div class="body">
      <div id="data-assemble__chart4"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "a4-chart",
  data() {
    return {};
  },
  methods: {
    registerAndSetCharts() {
      let charts2Ref = this.$echarts.init(
        document.getElementById("data-assemble__chart4")
      );
      let option2 = {
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        legend: {
          bottom: "5%",
        },
        grid: {
          left: "5%",
          right: "5%",
          bottom: "5%",
          containLabel: true,
        },
        series: {
          type: "pie",
          radius: "50%",
          label: {
            formatter: "{d}%",
          },
          data: [
            { value: 33, name: "库表" },
            { value: 34, name: "文件夹" },
            { value: 3, name: "接口" },
            { value: 30, name: "文件" },
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: "rgba(0, 0, 0, 0.5)",
            },
          },
        },
      };
      charts2Ref.setOption(option2);
    },
  },
  mounted() {
    this.registerAndSetCharts();
  },
};
</script>

<style lang="less" scoped>
.content-card {
  height: 100%;
  .title {
    display: flex;
    align-items: center;
    padding: 10px 0;
    background: linear-gradient(to right, #dee9ff, #ffffff);
    i {
      color: #6989c6;
      margin: 0 15px;
      font-size: 18px;
    }
    span {
      font-size: 16px;
      font-weight: 500;
    }
  }
  .body {
    width: 100%;
    height: 300px;
    :first-child {
      height: 100%;
      width: 100%;
    }
  }
}
</style>
